package com.hoshiibuy.veriCenter.exceptionHandler;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

import com.hoshiibuy.veriCenter.result.Result;

@RestControllerAdvice
public class CommonExceptionHandler {
	private final static Logger logger = LoggerFactory.getLogger(CommonExceptionHandler.class);

	/**
	 * 拦截Exception类的异常
	 * 
	 * @param e
	 * @return
	 */
	@ExceptionHandler(Exception.class)
	public Result<String> exceptionHandler(Exception e) {
		logger.error("系统异常：" + e.getMessage());
		return Result.wrap500Error("系统异常：" + e.getMessage());
	}
}
